#pragma once

#include <vector>
using namespace std;

#include <dshow.h>


class WinCamera
{
//-------directshow implements--------
private:
	ICaptureGraphBuilder2 * g_pCapture ;
private:
	HRESULT CaptureVideo(IGraphBuilder* pGraphBuilder);

//-------standard interface----------
private:
	int index;
	int state;
protected:
	static HRESULT EnumerateDevices(REFGUID category, IEnumMoniker **ppEnum);
	static vector<IMoniker*>* getCameras();
	static void releaseMonikers(vector<IMoniker*>*);

	WinCamera(int);
	HRESULT getCaptureFilter(IBaseFilter ** ppSrcFilter);
public:
	~WinCamera(void);

	static int count();
	static char* getCameraName(int index);
	static WinCamera* get(int index);
	void startPreview(int callback);
	void stopPreview();
	void startCapture(int callback);
	void stopCapture();
};
